package com.sbr.seb.entity.composants;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;


@Entity
public class Category implements Serializable {

	@Id
	private int id;
	private String name;
	private String description;
    @ManyToOne
	@JoinColumn(name="category_id")
	private Category upperCategory;
	@OneToMany(fetch=FetchType.LAZY, mappedBy="upperCategory")
	private List<Category> underCategoryList;
	
	@OneToMany(mappedBy="category")
	private List<Item> items;
	
	public Category() {
		
	}
	
	public Category(String name, String description) {
		this.name = name;
		this.description = description;
	}
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getDescription() {
		return description;
	}
	
	public void setDescription(String description) {
		this.description = description;
	}

	public Category getUpperCategory() {
		return upperCategory;
	}

	public void setUpperCategory(Category upperCategory) {
		this.upperCategory = upperCategory;
	}

	public List<Category> getUnderCategoryList() {
		return underCategoryList;
	}

	public void setUnderCategoryList(List<Category> underCategoryList) {
		this.underCategoryList = underCategoryList;
	}

	public List<Item> getItems() {
		return items;
	}

	public void setItems(List<Item> items) {
		this.items = items;
	}
	
}
